<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		

		<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
	</head>
	<body>
		<div id="app">
			{{message}}
		</div>
		
		<script>
			// 创建一个混入块对象
			const myMixin = {
				created(){
					console.log("created()方法被执行了")
					this.test()
				},
				data(){
					return{
						name:"Tom"
					}
				}
			}
			var app = Vue.createApp({
				mixins:[myMixin],
				data(){
					return {
						"message":"Hello Vue!",		
						"name":"jerry"   // 如果有同名的，以组件中为准
					}
				},
				methods:{
					test(){
						console.log("text()方法被执行了！")
						console.log(this.message);
						console.log(this.name);
					}
				}
			});
			var vm = app.mount("#app")	
		</script>
	</body>
</html>
